package org.perche.chat.client.services;

import org.perche.chat.thrift.services.gwt.GreetingService;
import org.perche.chat.thrift.services.gwt.GreetingService.IfaceAsync;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public class ChatServicesImpl implements ChatServices {

	private GreetingService.IfaceAsync greetingService = null;
	
	public IfaceAsync getGreetServer() {
		if (null == this.greetingService) {
			GreetingService.IfaceAsync service = GWT.create(GreetingService.Iface.class);
			ServiceDefTarget serviceDefTarget = (ServiceDefTarget) service;
			//TODO(tga) Constantise
			serviceDefTarget.setServiceEntryPoint(GWT.getModuleBaseURL() + "gwt/GreetService");
			this.greetingService = service;
		}
		return this.greetingService;
	}

}
